(in-package :leam)

(defgeneric on-handle-data( user-data msg data-stream )
  (:documentation "Callback when there is a message to process.
Data-stream is of type data-in-stream.  See data-in-stream.lisp" )
  (:method (user-data msg data-stream)))
(export 'on-handle-data)

(defgeneric on-handle-error( user-data msg stack-trace data-stream )
  (:documentation "Callback when there is an error.  Stack-trace
should provide stack information if the exception came from within the
system")
  (:method (user-data msg stack-trace data-stream)))
(export 'on-handle-error)

(defgeneric on-handle-ack( user-data msg )
  (:documentation "Callback for message acknowledged")
  (:method (user-data msg)
    (format t "generic ack handled ~a ~a~%" user-data msg)))
(export 'on-handle-ack)

(defgeneric on-handle-fin(user-data msg )
  (:documentation "Callback for message processing finished")
  (:method (user-data mesg)))
(export 'on-handle-fin)

(defgeneric on-handle-close(user-data)
  (:documentation "Callback for when the other side is shut down")
  (:method (user-data)))
(export 'on-handle-close)
